import { Decorator_DtoIsNumber_Base } from '@/common/decorators/dtoIsNumber';
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional } from 'class-validator';

export class CouponProduct_CreateUtil_Dto {
  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  @ApiProperty({ description: '优惠券Id' })
  couponId: number;

  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  @ApiProperty({ description: '平台Id' })
  platformId: number;

  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  @ApiProperty({ description: '规格Id' })
  productId: number;
}

export class CouponProduct_UpdateUtil_Dto extends CouponProduct_CreateUtil_Dto {
  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  id: number;
}

export class CouponProduct_Update_Dto {
  @ApiProperty({ description: '规格数组', type: [CouponProduct_UpdateUtil_Dto] })
  @IsNotEmpty()
  products: CouponProduct_UpdateUtil_Dto[];
}

export class CouponProduct_Create_Dto {
  @ApiProperty({ description: '规格数组', type: [CouponProduct_CreateUtil_Dto] })
  @IsNotEmpty()
  products: CouponProduct_CreateUtil_Dto[];
}

export class CouponProduct_FindAllByConponId_Dto {
  @Decorator_DtoIsNumber_Base()
  @ApiProperty({ description: '优惠券Id' })
  @IsNotEmpty()
  couponId: number;

  @Decorator_DtoIsNumber_Base()
  @ApiProperty({ description: '平台Id' })
  @IsOptional()
  platformId?: number;
}
